import { createBrowserRouter } from "react-router-dom";
import App from "../App";
import Home from "../pages/home/Index";
import Todo from "../pages/todo/Index";
import My from "../pages/my/Index";
const routes = createBrowserRouter([
  {
    path: "/",
    element: <App />,
    children: [
      {
        path: "home",
        element: <Home />,
      },
      {
        path: "todo",
        element: <Todo />,
      },
      {
        path: "my",
        element: <My />,
      },
    ],
  },
  {
    path: "/cart",
    async lazy() {
      const { default: Cart, loader } = await import("../pages/cart/Index");
      return {
        element: <Cart></Cart>,
        loader,
      };
    },
  },
]);
export default routes;
